package com.fwtai.api;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 分享推广访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2021-09-14 11:46:52
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class ApiShareDao{

  @Resource
  private DaoHandle dao;

  public int add(final PageFormData formData){
    return dao.execute("api_share.add",formData);
  }

  public HashMap<String,Object> queryCode(final String loginId){
    return dao.queryForHashMap("api_share.queryCode",loginId);
  }

  public String queryCodeExist(final String code){
    return dao.queryForString("api_share.queryCodeExist",code);
  }

  public HashMap<String,Object> listDataPage(final PageFormData formData){
    return dao.queryForPage(formData,"api_share.listData","api_share.listTotal");
  }

  public HashMap<String,Object> getIdentity(final String loginId){
    return dao.queryForHashMap("api_share.getIdentity",loginId);
  }

  public List<Map<String,Object>> getMyTeamList(final PageFormData formData){
    return dao.queryForListMap("api_share.getMyTeamList",formData);
  }

  public Integer getNextInfo(final Long loginId){
    return dao.queryForInteger("api_share.getNextInfo",loginId);
  }

  public HashMap<String,Object> getMyInviter(final Long loginId){
    return dao.queryForHashMap("api_share.getMyInviter",loginId);
  }
}